#ifndef EDITORCONTAINER_H
#define EDITORCONTAINER_H

#include "Include/IEditor.h"

class StatusBar;
class QAbstractTableModel;
namespace Plugins
{
class TextEditor;
class Project;

class EditorContainer : public QWidget, public Plugins::IEditor
{
    Q_OBJECT
    Q_INTERFACES(Plugins::IEditor)
public:
    EditorContainer(TextEditor *edit, QWidget *parent, Project * prj);
    virtual ~EditorContainer();
    virtual QWidget * widget();
    virtual QsciLexer * getLexer();
    virtual void setLexerByName(const QString& lexName);
    virtual bool save();
    virtual bool load(const QString & path);
    virtual void setText(const QString& text);
    virtual void setTheme(ITheme * theme = NULL, QFont * fnt = NULL);

    virtual void activate();
    virtual QString selectedText();
    virtual void find(const QString& find, bool forward);
    virtual void replace(const QString& find, const QString& replace, bool findNext, bool forward);
    virtual void replaceAll(const QString& find, const QString& replace);
    virtual bool isModified();
    virtual void setStatusBarVisible(bool show = true);
signals:
    void copyAvailable(bool);
    void undoAvailable(bool);
    void redoAvailable(bool);
    void pasteAvailable(bool);
    void modifyChanged(bool);
    void closeEditor();
    void severityChanged(int);
    void errorListChanged(QAbstractTableModel*);
    void fileNavigate(const QString&, int);
public slots:
    virtual void undo();
    virtual void redo();
    virtual void copy();
    virtual void cut();
    virtual void paste();
    virtual void del();
    virtual void selectAll();
    virtual void uppercase();
    virtual void lowercase();
    virtual void capitalize();
    virtual bool reset();
    virtual void jumpLine(int);
    virtual void jumpOffset(int);
protected:
    virtual void focusInEvent(QFocusEvent *);
    void addRightPanel(QWidget *panel);
private:
    TextEditor *_edit;
    StatusBar *_bar;
};
}
#endif // EDITORCONTAINER_H
